Concurrent Collections
1 Why use concurrent collections?
The main reasons are as follows:
The classic lists, collections, and arrays provided in the System.Collections and System.Collections.Generic namespaces are not thread-safe, and if
Java Collections FrameworkSet OR containerWe usually use arrays to save some basic data types. arrays are supported by the compiler, but an obvious disadvantage of arrays is that they have fixed sizes. In general, only when the program is running
collections or containers usually we use arrays to hold some basic data types, arrays are types supported by compilers, but one obvious disadvantage of arrays is that they have fixed sizes, and in general, only when the program is running can we
set OR container usually we use arrays to save some basic data types, arrays are types supported by compilers, but one obvious disadvantage of arrays is that they have fixed sizes, and in general, only when the program is running can we know the
Storage objects can be considered: arrays, collectionsArray Storage object features: student[] stu = new student[23]; Str[0] = new Student ();Cons: 1. Once created, its length cannot be changed2. The number of objects that a real array holds is not
The following table (table I) summarizes all the things you can do with a set (you can do the same thing with set and list, although the list also provides some extra functionality). The map is not inherited from collection, so it should be treated
1. Collection Framework (Overview and use of object arrays)
A: Case Demo
Requirement: I have 5 students, please store the information of the 5 students in an array, and iterate through the array to get each student information.
1. Set Frame (remove repeating string elements in ArrayList)
A: Case Demo
Requirement: ArrayList removes duplicate values of strings in the collection (the contents of the string are the same)
Idea: Create a new collection method /**
Listpublic interface Listextends CollectionAn ordered collection (also called a sequence) that allows repeating elements.Common Implementation classes:
ArrayList:The underlying use of the array structure, features: Fast query, adding and
1.Map Collection Overview and Features* A:map Interface Overview* To Repeat,* See API to know,* The object that maps the key to the value,* A map cannot contain duplicate keys,* Each key can be mapped to at most one value.* B:map interface and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.